package com.sjp.demo.dubbo.server.service.dubbo;

import com.sjp.demo.dubbo.api.response.BaseResponse;
import com.sjp.demo.dubbo.api.service.IDubboItemService;
import com.sjp.demo.dubbo.api.utils.ResponseUtils;
import com.sjp.demo.dubbo.model.entity.ItemInfo;
import com.sjp.demo.dubbo.model.mapper.ItemInfoMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Service(version = "${demo.service.version}")
public class DubboItemService implements IDubboItemService {

    @Autowired
    private ItemInfoMapper itemInfoMapper;

    @Override
    public BaseResponse listItems() {
        List<ItemInfo> list = itemInfoMapper.findList();
        return ResponseUtils.success(list);
    }
}
